package com.yunxun.coinmessage.dao;


import com.yunxun.coinmessage.entity.User;
import com.yunxun.coinmessage.sqlvo.UserVO;
import org.apache.ibatis.annotations.*;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Component;


import java.util.List;

@Mapper
@Component
public interface UserDao {
    @Select("select * from user order by status")
    List<User> queryAll();
    //启用禁用用户
    @Update("update user set status=#{status} where uid=#{uid}")
    Integer changeStatus(User user);
    //新增用户
    @Insert("insert into user(uname,upicture) values(#{uname},#{upicture})")
    Integer addUser(User user);
    @Select("select count(*) from user")
    Integer queryTotal();
    @Select("select * from user where uid=#{uid}")
     User queryById(Integer uid);
    @Select("select count(*) from user where uname like '%${uname}%'")
      int queryTotalByName(@Param("uname") String uname);
   //    基于配置文件实现查询
    List<User> queryByPage(UserVO userVO);
    @Update("update user set level=#{level} where uid=#{uid}")
    public void updateUserLevel(User user);
    @Select("select uid from user where uname like '%${uname}%'")
    public List<Integer> queryUidByUname(@Param("uname") String uname);
    @Select("select * from user where uid=(select uid from user_recom r where r.openid=#{openid})")
    public User queryRecom(String openid);
    public List<User> queryUserByOpenid(List<String> openidList);
}
